<?php

namespace app\common\model;

use think\Model;

class Order  extends Model
{

  protected $name = 'order';


  // 追加属性
  protected $append = [
    'status_text'
  ];
  public function getStatusTextAttr($value, $data)
  {
    if(!isset($data['order_status']))
      return '';

    switch ($data['order_status']){
      case 0:
        $text='未支付';
        break;
      case 1:
        $text='已支付待接单';
        break;
      case 2:
        $text='已接单待服务';
        break;
      case 3:
        $text='已出发';
        break;
      case 4:
        $text='已到达';
        break;
      case 5:
        $text='开始服务';;
        break;
      case 6:
        $text='已完成';;
        break;
      case 7:
        $text='未支付取消订单';;
        break;
      case 8:
        $text='评价完成';
        break;
      case 9:
        $text='退款成功';
        break;
      case 10:
        $text='技师拒绝接单';
        break;
      case 11:
        $text='订单超时未支付自动取消';
        break;
      case 12:
        $text='技师超时未接单自动取消(已支付)';
        break;
      case 13:
        $text='用户已支付取消订单';
        break;
      case 14:
        $text='加项补差价';
        break;
      default:
        $text='未知订单状态';
    }
    return $text;
  }
}